window.addEventListener('load', function () {
    var tel = document.querySelector('#tel');
    var regTel = document.querySelector('.reg_tel');
    tel.addEventListener('blur', function () {
        if (tel.value.length == 0) {
            regTel.className = 'reg_tel';
            regTel.innerHTML = '请输入11位手机号码';
        } else if (tel.value.length == 11) {
            regTel.className = 'success_icon';
            regTel.innerHTML = '';
        } else {
            regTel.className = 'error_icon';
            regTel.innerHTML = ' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; 手机号码格式不正确，请从新输入';
        }
    })
    var send = document.querySelector('.send');
    var time = 60;
    send.addEventListener('click', function () {
        send.disabled = true;
        var timer = setInterval(function () {
            if (time == 0) {
                clearInterval(timer);
                send.disabled = false;
                send.innerHTML = '点击发送';
                time = 60;
            } else {
                send.innerHTML = '剩余' + time + '秒';
                time--;
            }
        }, 1000)
    })
    var password = document.querySelector('#password');
    var regPassword = document.querySelector('.reg_password');
    password.addEventListener('blur', function () {
        if (password.value.length == 0) {
            regPassword.className = 'reg_password';
            regPassword.innerHTML = '请输入6位数以上数字或字母组合';
        } else if (password.value.length >= 6) {
            regPassword.className = 'success_icon';
            regPassword.innerHTML = '';
        } else {
            regPassword.className = 'error_icon';
            regPassword.innerHTML = ' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; 密码不少于6位数，请重新输入';
        }
    })
    var psd = document.querySelector('#psd');
    var regPsd = document.querySelector('.reg_psd');
    psd.addEventListener('blur', function () {
        if (psd.value.length == 0) {
            regPsd.className = 'reg_psd';
            regPsd.innerHTML = '请再次输入密码';
        } else if (psd.value == password.value) {
            regPsd.className = 'success_icon';
            regPsd.innerHTML = '';
        } else {
            regPsd.className = 'error_icon';
            regPsd.innerHTML = ' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; 密码不一致，请重新输入';
        }
    })
})
